home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 1 / BBS in a box - Trilogy I.iso / Files / Publish / J-L / lpr / lpr source / dlguser.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-19  |  3.1 KB  |  175 lines  |  [TEXT/MPS ]

  1. #if !defined(USEDUMP)
  2.     #include "lprlib.h"
  3.     #include "lprdef.h"
  4.     #include "lprfuncs.h"
  5. #else
  6.     #pragma load "lprDumpFile"
  7. #endif
  8.  
  9. unsigned char * mapptr;
  10.  
  11. extern unsigned char destflag;
  12. extern unsigned char headflag;
  13. extern unsigned char fmtstate;
  14.  
  15. pascal void destuser(wp, inum)
  16. WindowPtr wp; short inum;
  17. {
  18. short gtype;
  19. Handle gitem;
  20. Rect gbox;
  21. GrafPort mp;
  22. GrafPtr gp;
  23. OSErr rc;
  24.  
  25. GetDItem(wp, inum, >ype, &gitem, &gbox);
  26. rc = newmap(&mp, &gbox);
  27. if (rc != 0) return;
  28. GetPort(&gp);
  29. SetPort(&mp);
  30. MoveTo(gbox.left, gbox.top+12);
  31. switch(inum) {
  32.     case 10:
  33.         DrawString("\pUserid:");
  34.         break;
  35.     case 12:
  36.         DrawString("\pPassword:");
  37.         break;
  38.     default:
  39.         break;
  40.     }
  41. if (!destflag) {            /* copy of vmflag */
  42.     PenPat(&qd.gray);
  43.     PenMode(patBic);
  44.     PaintRect(&gbox);
  45.     }
  46. SetPort(wp);
  47. CopyBits(&mp.portBits, &(wp->portBits), &gbox, &gbox, srcCopy, 0L);
  48. SetPort(gp);
  49. ClosePort(&mp);
  50. DisposPtr(mapptr);
  51. }
  52.  
  53. pascal void headuser(wp, inum)
  54. WindowPtr wp; short inum;
  55. {
  56. short gtype;
  57. Handle gitem;
  58. Rect gbox;
  59. GrafPort mp;
  60. GrafPtr gp;
  61. OSErr rc;
  62.  
  63. GetDItem(wp, inum, >ype, &gitem, &gbox);
  64. rc = newmap(&mp, &gbox);
  65. if (rc != 0) return;
  66. GetPort(&gp);
  67. SetPort(&mp);
  68. MoveTo(gbox.left, gbox.top+12);
  69. switch(inum) {
  70.     case 6:
  71.         DrawString("\pIdentification:");
  72.         break;
  73.     case 8:
  74.         DrawString("\pJob name:");
  75.         break;
  76.     case 10:
  77.         DrawString("\pClassification:");
  78.         break;
  79.     default:
  80.         break;
  81.     }
  82. if (!headflag) {            /* copy of vmflag */
  83.     PenPat(&qd.gray);
  84.     PenMode(patBic);
  85.     PaintRect(&gbox);
  86.     }
  87. SetPort(wp);
  88. CopyBits(&mp.portBits, &(wp->portBits), &gbox, &gbox, srcCopy, 0L);
  89. SetPort(gp);
  90. ClosePort(&mp);
  91. DisposPtr(mapptr);
  92. }
  93.  
  94. pascal void fmtuser(wp, inum)
  95. WindowPtr wp; short inum;
  96. {
  97. short gtype;
  98. Handle gitem;
  99. Rect gbox;
  100. GrafPort mp;
  101. GrafPtr gp;
  102. OSErr rc;
  103.  
  104. GetDItem(wp, inum, >ype, &gitem, &gbox);
  105. rc = newmap(&mp, &gbox);
  106. if (rc != 0) return;
  107. GetPort(&gp);
  108. SetPort(&mp);
  109. MoveTo(gbox.left, gbox.top+12);
  110. PenPat(&qd.gray);
  111. PenMode(patBic);
  112. switch(inum) {
  113.     case 8:
  114.         DrawString("\pTitle:");
  115.         if (fmtstate == 1) PaintRect(&gbox);
  116.         break;
  117.     case 10:
  118.         DrawString("\pIndent:");
  119.         if (fmtstate == 1) PaintRect(&gbox);
  120.         break;
  121.     case 12:
  122.         DrawString("\pTop margin:");
  123.         if ((fmtstate == 1) || (fmtstate == 3))
  124.             PaintRect(&gbox);
  125.         break;
  126.     case 14:
  127.         DrawString("\pWidth:");
  128.         if (fmtstate == 1) PaintRect(&gbox);
  129.         break;
  130.     case 16:
  131.         DrawString("\pPage length:");
  132.         if ((fmtstate == 1) || (fmtstate == 3))
  133.             PaintRect(&gbox);
  134.         break;
  135.     case 20:
  136.         DrawString("\pTab spacing:");
  137.         if ((fmtstate == 1) || (fmtstate == 3))
  138.             PaintRect(&gbox);
  139.         break;
  140.     default:
  141.         break;
  142.     }
  143.  
  144. SetPort(wp);
  145. CopyBits(&mp.portBits, &(wp->portBits), &gbox, &gbox, srcCopy, 0L);
  146. SetPort(gp);
  147. ClosePort(&mp);
  148. DisposPtr(mapptr);
  149. }
  150.  
  151. OSErr newmap(wp, box)
  152. GrafPtr wp;
  153. Rect * box;
  154. {
  155. BitMap WriteMap;
  156. Size mapsize;
  157. GrafPtr gp;
  158.  
  159. WriteMap.bounds = *box;
  160. WriteMap.rowBytes =
  161.     (WriteMap.bounds.right - WriteMap.bounds.left + 7) >> 3;
  162. if (WriteMap.rowBytes%2) WriteMap.rowBytes++;
  163. mapsize = WriteMap.bounds.bottom - WriteMap.bounds.top;
  164. mapsize = mapsize * WriteMap.rowBytes;
  165. mapptr = NewPtr(mapsize);
  166. if (mapptr == 0L) return(4);
  167. WriteMap.baseAddr = mapptr;
  168. wp->portRect = WriteMap.bounds;
  169. GetPort(&gp);
  170. OpenPort(wp);
  171. SetPortBits(&WriteMap);
  172. EraseRgn(wp->visRgn);
  173. SetPort(gp);
  174. }
  175.